-- card: 17020 from stack: in.6 -- bmap block id: 0 -- flags: 0000 -- background id: 3411 -- name: Type 1 XCMD -- part 1 (button) -- low flags: 80 -- high flags: A003 -- rect: left=298 top=120 right=142 bottom=415 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Dialog Type ----- HyperTalk script ----- on mouseUp put "Do you want to export your data to a text file before quitting HyperCard?" into promptStr ShowDialog 1,3758,promptStr,TRUE if the result = 1 then put "You clicked on the “YES” button!" into bg fld "theResult" else if the result = 2 then put "You clicked on the “CANCEL” button!" into bg fld "theResult" else if the result = 3 then put "You clicked on the “NO” button!" into bg fld "theResult" end if end mouseUp -- part 2 (button) -- low flags: 80 -- high flags: A003 -- rect: left=300 top=180 right=202 bottom=417 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Alert Type ----- HyperTalk script ----- on mouseUp beep 1 ShowDialog 1,3757,"Do you really want to delete all cards in this stack?",TRUE if the result = 1 then put "You clicked on the “OK” button!" into bg fld "theResult" else put "You clicked on the “CANCEL” button!" into bg fld "theResult" end mouseUp -- part 4 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=11 top=4 right=64 bottom=78 -- title width / last selected line: 0 -- icon id / first selected line: 529 / 529 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: SD -- part contents for background part 21 ----- text ----- ShowDialog XCMD Type 1 -- part contents for background part 15 ----- text ----- ShowDialog Type 1 parameters are: ShowDialog 1,,, [,,] where 1 is the type of the external; is the resource ID of the DLOG template; consists of the dialog's text string; describes whether a button is to be outlined with black and thus be the default button. (The default button can be selected by typing RETURN or ENTER in addition to clicking on it). This parameter must be either TRUE or FALSE; The last two parameters are OPTIONAL. They are: and are used to set the top,left coordinates for placing the dialog. If these two parameters are omitted, the dialog will be centered within the card window. -- part contents for background part 17 ----- text ----- Creating the resources for ShowDialog XCMD Type 1: The requirements for creating DLOG templates for Type 1 of ShowDialog XCMD with ResEdit are: For "standard" dialogs and alerts the procID should be 1 (this describes how the dialog will "look"), the visible and goAwayFlag boxes must be unchecked, and the DLOG and associated DITL resources should be made purgeable. If you are going to have a default button, it MUST be DITL item #1. This is because the first item in the item list is always assumed to be the default button. The Macintosh Toolbox will interpret a press of the Return or Enter key as equivalent to a mouse click in the default button. In your DITL template your field (of type Static Text) that will contain the prompt string must contain the placeholder "^0" (don't use the quotes; and that's a zero). Your text will be substituted here. All items in the item list EXCEPT the buttons must be DISABLED. For alert boxes, you should precede your call to the external with "beep 1." It is a Macintosh convention that alerts beep when they are displayed on the screen. The item number clicked on will be returned in "the result". This is only true for ENABLED item numbers. -- part contents for background part 30 ----- text ----- 13 -- part contents for background part 18 ----- text ----- Type 1 of ShowDialog XCMD is used to create "standard" dialog and alert boxes that contain static text, icons, PICTs, and as many "regular" buttons as you want. You can modify the static text field on the fly by specifying a text string in the parameter list. You decide whether or not to have a default (outlined) button. You can specify where on the screen to place the dialog, or you can allow it to automatically center itself within the card window.